package rctgl;

public class RCTGLViewer
{
	private double m_vX, m_vY, m_vZ;
	private double m_rX, m_rY, m_rZ;
	
	public static final double MOVEUNIT = 10.0;
	
	private void fixRotation()
	{
		while(m_rX > 360)
			m_rX -= 360;
		
		while(m_rX < 0)
			m_rX += 360;
		
		while(m_rY > 360)
			m_rY -= 360;
		
		while(m_rY < 0)
			m_rY += 360;
		
		while(m_rZ > 360)
			m_rZ -= 360;
		
		while(m_rZ < 0)
			m_rZ += 360;
		
	}
	
	public void rotateRelative(double x, double y, double z)
	{
		m_rX += x;
		m_rY += y;
		m_rZ += z;
		
		fixRotation();
	}
	
	public void rotateAbsolute(double x, double y, double z)
	{
		m_rX = x;
		m_rY = y;
		m_rZ = z;
		
		fixRotation();
	}
	
	public void moveRelative(double x, double y, double z)
	{
		m_vX += x;
		m_vY += y;
		m_vZ += z;
	}
	
	public void moveAbsolute(double x, double y, double z)
	{
		m_vX = x;
		m_vY = y;
		m_vZ = z;
	}
	
	public double [] getPosition()
	{
		return new double [] {m_vX, m_vY, m_vZ};
	}
	
	public double [] getRotation()
	{
		return new double [] {m_rX, m_rY, m_rZ};
	}

}
